<%

Dim MHEMail
MHEMail = "Morus <morus@jebsen.com>"

Function SendMail (EmailTo, EmailFrom, CcTo, BCcTo, Subject, Body)	
	Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
	Const cdoSendUsingPort = 2
	Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
	Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
	Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
	Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
	Const cdoBasic = 1
	Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
	Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
	
	Dim objConfig  ' As CDO.Configuration
	Dim objMessage ' As CDO.Message
	Dim Fields     ' As ADODB.Fields
	
	' Get a handle on the config object and it's fields
	Set objConfig = Server.CreateObject("CDO.Configuration")
	Set Fields = objConfig.Fields
	
	' Set config fields we care about
	With Fields
		.Item(cdoSendUsingMethod)       = cdoSendUsingPort
		.Item(cdoSMTPServer)            = "JLNDHK01"
		.Item(cdoSMTPServerPort)        = 25
		.Item(cdoSMTPConnectionTimeout) = 10
		.Item(cdoSMTPAuthenticate)      = cdoBasic
		'.Item(cdoSendUserName)          = "username"
		'.Item(cdoSendPassword)          = "password"
	
		.Update
	End With
	
	Set objMessage = Server.CreateObject("CDO.Message")
	
	Set objMessage.Configuration = objConfig
	
	With objMessage
		.To       = EmailTo		
		.From     = EmailFrom
		.Subject  = Subject
        .HTMLBody = Body
        
        If CcTo <> "" Then	.Cc = CcTo
        If BCcTo <> "" Then	.Bcc = BCcTo
		
		.Send
	End With
	
	Set Fields = Nothing
	Set objMessage = Nothing
	Set objConfig = Nothing
	
End Function

'testing
'SendMail "Victor Tai", "victortai@goatstudio.com", "Victor Tai", "victor_tai@jjsea.com", "", "Welcome to Morus", "body: testing cdo <b>ABC</b>"

%>

<%

  Dim MailBody
  
  	Set rs = Server.CreateObject("ADODB.Recordset")
		rs.ActiveConnection = "DSN=morus;UID=sa;PWD=litestep;"
		rs.Source = "SELECT (user_firstname + ' ' + user_midname + ' ' + user_lastname) AS DisplayName, user_mailid, user_password, user_email FROM master_users WHERE user_status = 1"
		rs.CursorType = 0
		rs.CursorLocation = 2
		rs.LockType = 1
		rs.Open()		
		
		
        If Not rs.EOF Then		
        
            While Not rs.EOF
		
                MailBody = ""		
  
                MailBody = MailBody & "<p>Dear colleagues,</p>"
                MailBody = MailBody & "<p>The new Intranet service, named Morus, is available to you with effect from Sept 29, 2008 (Mon). In this soft launch, you will enjoy a brand new interface written on the latest Web 2.0 technology.</p>"
                MailBody = MailBody & "<p>You will see a number of differences from the old Intranet, including a new consolidated news section, a dedicated segment for Group announcements and a poll feature that you can take part in.</p>"
                MailBody = MailBody & "<p>Among the latest news is a series of articles related to the following:</p>"
                MailBody = MailBody & "<p>"
                MailBody = MailBody & "<br>> How to log in to Morus"
                MailBody = MailBody & "<br>> Language and other options"
                MailBody = MailBody & "<br>> Personal profile and photo upload"
                MailBody = MailBody & "<br>> Links to Oracle applications"
                MailBody = MailBody & "<br>> News sharing – now everyone can post"
                MailBody = MailBody & "<br>> Where to find information on corporate policies, HR, IT, finance, etc."
                MailBody = MailBody & "<br>> Where to find information on corporate policies, HR, IT, finance, etc."
                MailBody = MailBody & "<br>> Training prior to official launch Jan 2009"
                MailBody = MailBody & "<br>> Temporary links to old Intranet and telephone directory"
                MailBody = MailBody & "</p>"
                MailBody = MailBody & "<p>Please refer to Morus for more detailed information on the above – you will find most of the answers here. For your convenience, some of the frequently asked questions can also be found under Morus > Helpdesk > FAQ.</p>"
                MailBody = MailBody & "<p>Should you require any further clarification, feel free to send an online enquiry via Morus > Helpdesk > Contact Morus.</p>"
                MailBody = MailBody & "<p>&nbsp;</p>"
                MailBody = MailBody & "<p>Morus Team</p>"
                MailBody = MailBody & "<p><font face='arial' color='#ff0000' size=1>*** This is a system-generated message. Please do not reply to this email. ***</font></p>"
                  
                MailBody = MailBody & "<p>&nbsp;</p>"
                MailBody = MailBody & "<p><hr></p>"
                MailBody = MailBody & "<p>&nbsp;</p>"
                
                MailBody = MailBody & "<p>各位同事</p>"
                MailBody = MailBody & "<p>新的联网服务，名为Morus，将于2008年9月29日（星期一）启用 。 在这个试用期，你会体验到一个全新以Web 2.0技术打造的网页界面。 </p>"
                MailBody = MailBody & "<p>与旧的内联网不同的地方，包括新的综合新闻，供企业宣传专用的部分，以及欢迎你参与的民意调查。</p>"
                MailBody = MailBody & "<p>你可以在最新新闻里找到一系列的有关消息： </p>"
                MailBody = MailBody & "<p>"
                MailBody = MailBody & "<br>〉如何登录Morus"
                MailBody = MailBody & "<br>〉语言和其他选项"
                MailBody = MailBody & "<br>〉个人资料和照片上载"
                MailBody = MailBody & "<br>〉链接到Oracle应用软件"
                MailBody = MailBody & "<br>〉新闻分享-现在每个人都可以张贴"
                MailBody = MailBody & "<br>〉在哪里可以找到有关企业政策，人力资源，资讯科技，财务与会计等资料"
                MailBody = MailBody & "<br>〉自动发送的在线通知和电子邮件通知"
                MailBody = MailBody & "<br>〉2009年1月正式使用之前的训练"
                MailBody = MailBody & "<br>〉旧内联网和电话簿的链接"
                MailBody = MailBody & "</p>"
                MailBody = MailBody & "<p>请登上Morus参阅更详细的资料--你会发现大多数的答案就在这里。 为了你的方便，你也可以参考Morus > 服务中心 > 常见问题。 </p>"
                MailBody = MailBody & "<p>如果你需要任何进一步的澄清，请随时通过Morus > 服务中心 > 联络Morus询问。 </p>"
                MailBody = MailBody & "<p>&nbsp;</p>"
                MailBody = MailBody & "<p>Morus小组</p>"
                MailBody = MailBody & "<p><font face='arial' color='#ff0000' size=1>*** 这是一个由系统自动发送的邮件,请不要回复。 ***</font></p>"
                
                Response.Write MailBody
                
                'SendMail "darrenhow@jebsen.com", "morus@jebsen.com", "", "", "Welcome to Morus", MailBody
                
                rs.MoveNext
            Wend
        End If     
        
        rs.Close
        Set rs = Nothing                     
%>